import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/search'
    },
    {
      path: '/search',
      name: 'search',
      component: () => import('../views/search/index.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/login/login.vue')
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('../views/login/register.vue')
    },
    {
      path: '/shop',
      name: 'shop',
      component: () => import('../views/shop/index.vue'),
      children: [
        {
          path: '/product/list',
          name: 'productList',
          component: () => import('../views/shop/product/index.vue')
        }
      ]
    },
    {
      path: '/shop/register',
      name: 'shopRegister',
      component: () => import('../views/shop/login/register.vue')
    }
  ],
})

export default router
